<template>
  <div class="PhoneList">
    <List
      :linklist="linklist"
      :tableData="tableData"
      :btnList="btnList"
      :titleList="titleList"
      :btnState="btnState"
    ></List>
  </div>
</template>

<script>
import List from "../../components/List.vue";
import { FinanceDeptAxios } from "../../http/apis/AdressBookApi/index";
export default {
  name: "FinanceDept",
  method: {},
  components: {
    List,
  },
  data() {
    return {
      btnState: 2,
      currentPage: 1, //当前页
      pageSize: 5, //页数
       linklist: [
        {
          id: 0,
          name: "真实姓名",
          isRouter: true,
        },
        {
          id: 1,
          name: "性别",
          isRouter: true,
        },
        {
          id: 2,
          name: "手机号码",
          isRouter: false,
        },
        {
          id: 3,
          name: "电子邮箱",
          isRouter: false,
        },
        {
          id: 4,
          name: "部门",
          isRouter: false,
        },
        {
          id: 5,
          name: "生日",
          isRouter: false,
        },
        {
          id: 6,
          name: "入司时间",
          isRouter: false,
        }
      ],
      // 操作数据
      btnList: [
        {
          id: "1",
          name: "修改",
        },
        {
          id: "2",
          name: "删除",
        },
      ],
      // 字段名称
      titleList: [
        "employee_name",
        "employee_sex",
        "employee_tel",
        "employee_email",
        "employee_role",
        "employee_birthday",
        "employee_jointime",
      ],
      // 表格数据
      tableData: []
    };
  },
  created() {
    FinanceDeptAxios(this.currentPage, this.pageSize)
      .then((res) => {
        console.log("财务部成功", res.data);
        let arr = res.data.data;
        this.tableData = arr
         arr.map(item => {
          if(item.employee_sex == '1'){
            item.employee_sex = '男'
          }else if(item.employee_sex == '0'){
            item.employee_sex = '女'
          }
        });
      })
      .catch((err) => {
        console.log("财务部失败", err);
      });
  },
};
</script>
<style>
</style>